import sys

import pygame
from pygame.locals import QUIT

pygame.init()
DISPLAYSURF =pygame.display.set_mode((400,300))
pygame.display.set_caption("cads")
WHITE = (255, 255, 255)
GREEN = (0, 255, 0)
BLUE = (0, 0, 128)
fontObj = pygame.font.Font('freesansbold.ttf', 32) #创建font对象
textSurfaceObj = fontObj.render('Hello world!', True, GREEN, BLUE)
textRectObj = textSurfaceObj.get_rect()
textRectObj.center = (200, 150)
while True: # main game loop
  DISPLAYSURF.fill(WHITE)
  DISPLAYSURF.blit(textSurfaceObj, textRectObj)
  for event in pygame.event.get():
    if event.type == QUIT:
      pygame.quit()
      sys.exit()
  pygame.display.update()








